﻿@model  SendGrid.ASPSamples.Models.EmailContract
@{
    ViewBag.Title = "Register";
}

@using (Html.BeginForm("Send", "Email", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
    @Html.AntiForgeryToken()
    <h4>Send an Email</h4>
    <hr />
    @Html.ValidationSummary("", new { @class = "text-danger" })

    if (ViewBag.Success!=null && (bool)ViewBag.Success)
    {
        <h2 class="text-danger">Email sent. Happy coding</h2>
    }
    else if(ViewBag.Success != null && !(bool)ViewBag.Success)
    {
        <h2 class="text-danger">Ooops , retry ninja</h2>
    }


    <div class="form-group">
        @Html.LabelFor(m => m.FromEmailAddress, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.FromEmailAddress, new { @class = "form-control" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.ToEmailAddress, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.ToEmailAddress, new { @class = "form-control" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.BccEmailAddress, new {@class = "col-md-2 control-label"})
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.BccEmailAddress, new {@class = "form-control"})
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.CcEmailAddress, new {@class = "col-md-2 control-label"})
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.CcEmailAddress, new {@class = "form-control"})
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.Subject, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.TextBoxFor(m => m.Subject, new { @class = "form-control" })
        </div>
    </div>
    <div class="form-group">
        @Html.LabelFor(m => m.Body, new { @class = "col-md-2 control-label" })
        <div class="col-md-10">
            @Html.TextAreaFor(m => m.Body, new { @class = "form-control" })
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" class="btn btn-default" value="Send" />
        </div>
    </div>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
